﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

  using System.Data.SqlClient;
namespace student
{
    public partial class Form1 : Form
      
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DataTable studt = new DataTable("student");
            DataColumn sno = new DataColumn();
            sno = studt.Columns.Add("sno", typeof(int));
            sno.AllowDBNull = false;
            sno.Unique = true;
            DataColumn sname = new DataColumn();
            sname = studt.Columns.Add("sname", typeof(string));
            sname.AllowDBNull = false;
            sname.Unique = false;
            DataColumn ssex = new DataColumn();
            sname = studt.Columns.Add("ssex", typeof(string));
            sname.AllowDBNull = false;
            sname.Unique = false;
            ssex.DefaultValue = '男';
            DataColumn sbirthday= new DataColumn();
            sname = studt.Columns.Add("sbirthday", typeof(string));
            sbirthday.DefaultValue = DateTime.Now.ToLongDateString();
            studt.Columns.Add("sclass",typeof(string));
            DataRow dr = studt.NewRow();
            dr["sno"]=1001;
             dr["sname"]="张三";
             dr["ssex"]="男";
             dr["sbirthday"]="1980-2-1";
             dr["sclass"]="98002";
             studt.Rows.Add(dr);
             for (int i = 0; i < studt.Rows.Count; i++)
             { 
                 label1.Text="编号："+dr["sno"].ToString()+
                     ";姓名："+dr["sname"].ToString()+ 
                     "; 性别："+dr["ssex"].ToString()+  
                     ";生日："+dr["sbirthday"].ToString()+ 
                     ";班级："+dr["sclass"].ToString();
             }

            
        }
    }
}
